package studychinese.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.hschinese.pronunciation.R;
import com.hschinese.pronunciation.activity.EntryConstructionActivity;
import com.hschinese.pronunciation.activity.StudayChinesePracticeActivity;
import com.hschinese.pronunciation.activity.StudayRecognitionActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import studychinese.activity.ChinaReportActivity;
import studychinese.activity.StrokesListActivity;


public class ChineseCharacterFragment extends BaseFragment implements View.OnClickListener{


    @Bind(R.id.entry_title1)
    ImageView entryTitle1;
    @Bind(R.id.entry_about)
    ImageView entryAbout;
    @Bind(R.id.entry_test_result)
    ImageView entryTestResult;
    @Bind(R.id.entry_title2)
    ImageView entryTitle2;
    @Bind(R.id.rl_entry_title1)
    RelativeLayout rlEntryTitle1;
    @Bind(R.id.btn_bihua)
    ImageView btnBihua;
    @Bind(R.id.btn_bishun)
    ImageView btnBishun;
    @Bind(R.id.btn_jiegou)
    ImageView btnJiegou;
    @Bind(R.id.btn_read)
    ImageView btnRead;
    @Bind(R.id.btn_practice)
    ImageView btnPractice;
//正字入口
    public ChineseCharacterFragment() {
        // Required empty public constructor
    }


    public static ChineseCharacterFragment newInstance() {

        Bundle args = new Bundle();

        ChineseCharacterFragment fragment = new ChineseCharacterFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.fragment_chinese_character, container, false);
        ButterKnife.bind(this, inflate);
        init();
        return inflate;
    }

    private void init() {
        btnBihua.setOnClickListener(this);
        btnBishun.setOnClickListener(this);
        btnJiegou.setOnClickListener(this);
        btnRead.setOnClickListener(this);
        btnPractice.setOnClickListener(this);
        entryAbout.setOnClickListener(this);
        entryTestResult.setOnClickListener(this);
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.btn_bihua:
                startActivity(new Intent(getActivity(),StrokesListActivity.class).putExtra("type",1));
                 break;
            case R.id.btn_bishun:
                startActivity(new Intent(getActivity(),StrokesListActivity.class).putExtra("type",2));
                break;
            case R.id.btn_jiegou:
                startActivity(new Intent(getActivity(),EntryConstructionActivity.class).putExtra("type",13));
                break;
            case R.id.btn_read:
             startActivity(new Intent(getActivity(),StudayRecognitionActivity.class).putExtra("type",14));
                break;
            case R.id.btn_practice:
                startActivity(new Intent(getActivity(),StudayChinesePracticeActivity.class).putExtra("type",15));
                break;
            case R.id.entry_test_result:
                startActivity(new Intent(getActivity(),ChinaReportActivity.class));
                break;
        }
    }
}
